﻿using log4net.Config;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FtpFileBackup_Oracle.LogHelper
{
    public static class log4netHelper
    {
        static log4netHelper()
        {
            var logCfg = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "\\log4net.config");
            XmlConfigurator.ConfigureAndWatch(logCfg);
        }

        private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");

        public static void Debug(object message)
        {
            if (loginfo.IsDebugEnabled)
            {
                loginfo.Debug(message);
            }
        }

        public static void Info(object message)
        {
            if (loginfo.IsInfoEnabled)
            {
                loginfo.Info(message);
            }
        }
        public static void Error(object message)
        {
            if (loginfo.IsErrorEnabled)
            {
                loginfo.Error(message);
            }
        }
        public static void Fatal(object message)
        {
            if (loginfo.IsFatalEnabled)
            {
                loginfo.Fatal(message);
            }
        }
        public static void Warn(object message)
        {
            if (loginfo.IsWarnEnabled)
            {
                loginfo.Warn(message);
            }
        }
    }
}
